<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script>
	var num = 0;
	
	var tmout = setTimeout(treat,3000);
	
	function treat(){
		num++;
		var content =document.getElementById("content");
		content.innerHTML = num+"item";	
		
		if(num < 3){
			setTimeout(treat,3000);
		}
	}
	
	var interval = setInterval(function(){
		var sub = document.getElementById("sub");
		sub.innerHTML = num+" sub--";
	},4000);
</script>
</head>
<body>
	<div id="content"></div>
	<div id="sub"></div>
</body>
</html>